package com.xbongbong.saas.enums.mini;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;
import lombok.ToString;

/**
 * 应用模块名称<p>
 * 代码描述<p>
 * Company: 逍邦网络科技有限公司<p>
 *
 * @author chenshan
 * @version v1.0
 * @since 2020/9/3 1:41 下午
 */
@Getter
@ToString
public enum DingBundleStatusEnum {
    
    NORMAL(1,"正常"),
    DISMISS(2,"解散群"),
    DISABLE(3,"不启用群插件"),
    
    /**
     * 未知规则,当异常时用于返回
     */
    UNKNOWN(404, "");
    ;
    
    private Integer code;
    
    private String name;
    
    DingBundleStatusEnum(Integer code, String name){
        this.code= code;
        this.name= name;
    }
    
    public static DingBundleStatusEnum getByCode(Integer code) {
        for ( DingBundleStatusEnum cacheCode : values()) {
            if (cacheCode.getCode().equals(code)) {
                return cacheCode;
            }
        }
        return UNKNOWN;
    }
    
}
